﻿
// WDDManagerDlg.h: 头文件
//

#pragma once

#include "Workspace/UGWorkspace.h"
#include "Workspace/UGWorkspaceConnection.h"

using namespace std;
using namespace UGC;

// CWDDManagerDlg 对话框
class CWDDManagerDlg : public CDialog
{
	// 构造
public:
	CWDDManagerDlg(CWnd* pParent = nullptr);	// 标准构造函数

	// 对话框数据
#ifdef AFX_DESIGN_TIME
	enum { IDD = IDD_WDDMANAGER_DIALOG };
#endif

protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV 支持


	// 实现
private:
	UGWorkspace* m_workspace = nullptr;	// 工作空间
	CString m_workspaceFilter = _T("文件型工作空间（*.smwu; *.sxwu;）|*.smwu;*.sxwu");
	CString m_datasourceFilter = _T("文件型数据源（*.udbx）|*.udbx");
	CString m_tempWorkspacePath; // 临时工作空间
protected:
	HICON m_hIcon;
	CMenu* m_menu;	// 菜单
	CTreeCtrl m_workspaceTree;	// 工作空间树

	// 生成的消息映射函数
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	DECLARE_MESSAGE_MAP();
	afx_msg void InitWorkspaceTreeIconList();
	afx_msg void UpdateMenuStatus();
	afx_msg void UpdateWorkspaceTree();
	afx_msg int GetDatasetIconIndex(UGDataset::DatasetType datasetType);
	afx_msg UGString GetAvailableDatasetName(UGDataSource* datasource, UGString datasetName);
	afx_msg UGint GetWorkspaceType(CString workspaceFileExt);
	afx_msg UGbool IsExistedDataset(UGWorkspace* workspace, UGDataset::DatasetType datasetType);
	afx_msg UGbool CreateDefaultDatasetVector(UGWorkspace* workspace, UGDataset::DatasetType datasetType, std::string datasetName);
	afx_msg UGbool CreateDefaultDatasetRaster(UGWorkspace* workspace, UGDataset::DatasetType datasetType, std::string datasetName);
	afx_msg UGbool CloseDataset(UGWorkspace* workspace, UGDataset::DatasetType datasetType);
public:
	afx_msg void OnAboutMenuItem();
	afx_msg void OnCreateWorkspace();
	afx_msg void OnOpenWorkspace();
	afx_msg void OnSaveWorkspace();
	afx_msg void OnSaveAsWorkspace();
	afx_msg void OnCloseWorkspace();
	afx_msg void OnCreateDatasource();
	afx_msg void OnOpenDatasource();
	afx_msg void OnSaveDatasource();
	afx_msg void OnDestroy();
	afx_msg void OnCloseDatasource();
	afx_msg void OnCreatePointDataset();
	afx_msg void OnCreateLineDataset();
	afx_msg void OnCreateRegionDataset();
	afx_msg void OnClosePointDataset();
	afx_msg void OnCloseLineDataset();
	afx_msg void OnCloseRegionDataset();
	afx_msg void OnCreatePoint3DDataset();
	afx_msg void OnCreateLine3DDataset();
	afx_msg void OnCreateRegion3DDataset();
	afx_msg void OnCreateModelDataset();
	afx_msg void OnClosePoint3DDataset();
	afx_msg void OnCloseLine3DDataset();
	afx_msg void OnCloseRegion3DDataset();
	afx_msg void OnCloseModelDataset();
	afx_msg void OnCreateCADDataset();
	afx_msg void OnCloseCADDataset();
	afx_msg void OnCreateRasterDataset();
	afx_msg void OnCloseRasterDataset();
	afx_msg void OnCreateImageDataset();
	afx_msg void OnCloseImageDataset();
	afx_msg void OnCreateTabluar();
	afx_msg void OnCloseTabular();
};
